/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Equivalents.impl;

import EA_Model.IEC61970.Domain.ActivePower;
import EA_Model.IEC61970.Domain.Voltage;

import EA_Model.IEC61970.Equivalents.EquivalentInjection;
import EA_Model.IEC61970.Equivalents.EquivalentsPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Equivalent Injection</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentInjectionImpl#getMaxP <em>Max P</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentInjectionImpl#getMinP <em>Min P</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentInjectionImpl#getRegulationCapability <em>Regulation Capability</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentInjectionImpl#getRegulationStatus <em>Regulation Status</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentInjectionImpl#getRegulationTarget <em>Regulation Target</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EquivalentInjectionImpl extends EquivalentEquipmentImpl implements EquivalentInjection {
	/**
	 * The cached value of the '{@link #getMaxP() <em>Max P</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxP()
	 * @generated
	 * @ordered
	 */
	protected ActivePower maxP;

	/**
	 * The cached value of the '{@link #getMinP() <em>Min P</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinP()
	 * @generated
	 * @ordered
	 */
	protected ActivePower minP;

	/**
	 * The cached value of the '{@link #getRegulationCapability() <em>Regulation Capability</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRegulationCapability()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean regulationCapability;

	/**
	 * The cached value of the '{@link #getRegulationStatus() <em>Regulation Status</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRegulationStatus()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean regulationStatus;

	/**
	 * The cached value of the '{@link #getRegulationTarget() <em>Regulation Target</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRegulationTarget()
	 * @generated
	 * @ordered
	 */
	protected Voltage regulationTarget;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EquivalentInjectionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return EquivalentsPackage.Literals.EQUIVALENT_INJECTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower getMaxP() {
		if (maxP != null && maxP.eIsProxy()) {
			InternalEObject oldMaxP = (InternalEObject)maxP;
			maxP = (ActivePower)eResolveProxy(oldMaxP);
			if (maxP != oldMaxP) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P, oldMaxP, maxP));
			}
		}
		return maxP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower basicGetMaxP() {
		return maxP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxP(ActivePower newMaxP) {
		ActivePower oldMaxP = maxP;
		maxP = newMaxP;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P, oldMaxP, maxP));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower getMinP() {
		if (minP != null && minP.eIsProxy()) {
			InternalEObject oldMinP = (InternalEObject)minP;
			minP = (ActivePower)eResolveProxy(oldMinP);
			if (minP != oldMinP) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P, oldMinP, minP));
			}
		}
		return minP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower basicGetMinP() {
		return minP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinP(ActivePower newMinP) {
		ActivePower oldMinP = minP;
		minP = newMinP;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P, oldMinP, minP));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getRegulationCapability() {
		if (regulationCapability != null && regulationCapability.eIsProxy()) {
			InternalEObject oldRegulationCapability = (InternalEObject)regulationCapability;
			regulationCapability = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldRegulationCapability);
			if (regulationCapability != oldRegulationCapability) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY, oldRegulationCapability, regulationCapability));
			}
		}
		return regulationCapability;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetRegulationCapability() {
		return regulationCapability;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRegulationCapability(EA_Model.IEC61970.Domain.Boolean newRegulationCapability) {
		EA_Model.IEC61970.Domain.Boolean oldRegulationCapability = regulationCapability;
		regulationCapability = newRegulationCapability;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY, oldRegulationCapability, regulationCapability));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getRegulationStatus() {
		if (regulationStatus != null && regulationStatus.eIsProxy()) {
			InternalEObject oldRegulationStatus = (InternalEObject)regulationStatus;
			regulationStatus = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldRegulationStatus);
			if (regulationStatus != oldRegulationStatus) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS, oldRegulationStatus, regulationStatus));
			}
		}
		return regulationStatus;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetRegulationStatus() {
		return regulationStatus;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRegulationStatus(EA_Model.IEC61970.Domain.Boolean newRegulationStatus) {
		EA_Model.IEC61970.Domain.Boolean oldRegulationStatus = regulationStatus;
		regulationStatus = newRegulationStatus;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS, oldRegulationStatus, regulationStatus));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getRegulationTarget() {
		if (regulationTarget != null && regulationTarget.eIsProxy()) {
			InternalEObject oldRegulationTarget = (InternalEObject)regulationTarget;
			regulationTarget = (Voltage)eResolveProxy(oldRegulationTarget);
			if (regulationTarget != oldRegulationTarget) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET, oldRegulationTarget, regulationTarget));
			}
		}
		return regulationTarget;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetRegulationTarget() {
		return regulationTarget;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRegulationTarget(Voltage newRegulationTarget) {
		Voltage oldRegulationTarget = regulationTarget;
		regulationTarget = newRegulationTarget;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET, oldRegulationTarget, regulationTarget));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P:
				if (resolve) return getMaxP();
				return basicGetMaxP();
			case EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P:
				if (resolve) return getMinP();
				return basicGetMinP();
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY:
				if (resolve) return getRegulationCapability();
				return basicGetRegulationCapability();
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS:
				if (resolve) return getRegulationStatus();
				return basicGetRegulationStatus();
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET:
				if (resolve) return getRegulationTarget();
				return basicGetRegulationTarget();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P:
				setMaxP((ActivePower)newValue);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P:
				setMinP((ActivePower)newValue);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY:
				setRegulationCapability((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS:
				setRegulationStatus((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET:
				setRegulationTarget((Voltage)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P:
				setMaxP((ActivePower)null);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P:
				setMinP((ActivePower)null);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY:
				setRegulationCapability((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS:
				setRegulationStatus((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET:
				setRegulationTarget((Voltage)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_INJECTION__MAX_P:
				return maxP != null;
			case EquivalentsPackage.EQUIVALENT_INJECTION__MIN_P:
				return minP != null;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_CAPABILITY:
				return regulationCapability != null;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_STATUS:
				return regulationStatus != null;
			case EquivalentsPackage.EQUIVALENT_INJECTION__REGULATION_TARGET:
				return regulationTarget != null;
		}
		return super.eIsSet(featureID);
	}

} //EquivalentInjectionImpl
